from django.db import models

# Create your models here.

class threatdb(models.Model):
    # ID
    id = models.AutoField(verbose_name='序号', primary_key=True)
    #域名
    domains = models.CharField(verbose_name='域名',max_length=100)
    #ip
    ip = models.GenericIPAddressField(verbose_name='IP地址')
    #是否恶意
    is_malicious = models.CharField(verbose_name='是否恶意',max_length=10)
    #运营商
    carrier = models.CharField(verbose_name='运营商',max_length=100)
    #国家
    country = models.CharField(verbose_name='国家',max_length=100)
    #省
    province = models.CharField(verbose_name='省',max_length=100)
    #市
    city = models.CharField(verbose_name='市',max_length=100)
    #严重级别
    severity = models.CharField(verbose_name='严重级别',max_length=100)
    #情报更新时间
    update_time = models.DateTimeField(verbose_name='情报更新时间')
    #情报来源
    ti_source = models.CharField(verbose_name='情报来源',max_length=50,default="")
    #情报查询时间
    search_time = models.DateField(verbose_name='查询时间',auto_now_add=True)
    

    class Meta:
        verbose_name = '情报信息'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name

class apinfo(models.Model):
    # ID
    id = models.AutoField(verbose_name='序号', primary_key=True)
    #api名称
    apitype = models.CharField(verbose_name='api名称',max_length=10)
    #apikey
    apikey = models.CharField(verbose_name='apikey',max_length=100, blank=False, null=False)

    class Meta:
        verbose_name = 'api设置'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name